package org.jeecg.modules.config.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.jeecg.modules.config.entity.WlhyBank;
import org.jeecg.modules.config.mapper.WlhyBankMapper;
import org.jeecg.modules.config.service.IWlhyBankService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 银行
 * @Author: jeecg-boot
 * @Date:   2024-04-10
 * @Version: V1.0
 */
@Service
public class WlhyBankServiceImpl extends ServiceImpl<WlhyBankMapper, WlhyBank> implements IWlhyBankService {

    @Override
    public void updateStatusById(String id, String rowStatus) {
        update(new LambdaUpdateWrapper<WlhyBank>().eq(WlhyBank::getId,id).set(WlhyBank::getStatus,rowStatus));
    }

    @Override
    public void updateStatusByIds(List<String> ids, String rowStatus) {
        update(new LambdaUpdateWrapper<WlhyBank>().in(WlhyBank::getId,ids).set(WlhyBank::getStatus,rowStatus));
    }

    @Override
    public Boolean prefixCheck(List<String> prefixs, String bankCardNo) {
        for (String prefix : prefixs) {
            if (bankCardNo.startsWith(prefix.trim())) {
                return true;
            }
        }
        return false;
    }
}
